package com.bien.springboot.property;

import lombok.Data;
import org.apache.commons.lang.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

@Data
@Configuration
@ConfigurationProperties(prefix = "spring.cas")
public class SpringCasProperty {

    private Boolean enabled;
    private List<String> ignorePatternFilters = new ArrayList<String>();

    private CasLoginProperty login;
    private CasLogoutProperty logout;

    public String getIgnorePatternFiltersString() {
        return ignorePatternFilters.size() != 0 ? StringUtils.join(ignorePatternFilters.toArray(), "|") : null;
    }
}

